package com.to3ks.common.base.utils;

import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;


import java.util.List;

@Slf4j
public class StringUtil {

    /**
     * 将List<String>集合 转化为带引号的String
     * 如{"1","2"} To '1','2'
     *
     * @param str 入参
     * @return String
     */
    public static String convertToDyhString(String str) {
        StringBuffer sb = new StringBuffer();
        if(str ==null) return "''";
        sb.append("'").append(str.replace("'"," ")).append("'"); //字符串首尾加上单引号
        //log.info(sb.toString());
        return sb.toString();
  }


    /**
     * 定位字符
     */
    public static int ilocateChar(String full, char c){

        int location=-1;
        for (int i = 0; i < full.length(); i++) {
            if (c == full.charAt(i)) {
                //System.out.print(i + "\t");
                location = i;
            }
        }
        return location;
    }

}
